package com.airsystem.pos.bengkel.entity.wrapper;

import java.math.BigDecimal;

import com.airsystem.pos.bengkel.entity.DetailPesanSparepart.Metode;
import com.airsystem.pos.bengkel.entity.PesanSparepart;
import com.airsystem.pos.bengkel.view.dialog.SparepartOrderDialog;

/**
 * This class contains data for displaying Sparepart Order history,
 * <br>
 * in {@link SparepartOrderDialog} view.
 * <br>
 * 
 * @author Fanny Irawan Sutawanir (fannyirawans@gmail.com)
 */
public class PesanSparepartWrapper {
	/* "Tanggal Pesan", "Total Produk", "Total Harga", "Pembayaran" */
	private final PesanSparepart pesanSparepart;

	private final String tanggalPesan;

	private final Integer totalProduk;

	private final BigDecimal totalHarga;

	private final Metode metode;

	public PesanSparepartWrapper(PesanSparepart pesanSparepart, String tanggalPesan, Integer totalProduk, BigDecimal totalHarga, Metode metode) {
		this.pesanSparepart = pesanSparepart;
		this.tanggalPesan = tanggalPesan;
		this.totalProduk = totalProduk;
		this.totalHarga = totalHarga;
		this.metode = metode;
	}

	public PesanSparepart getPesanSparepart() {
		return pesanSparepart;
	}

	public String getTanggal() {
		return tanggalPesan;
	}

	public String getTotalProduk() {
		return String.valueOf(totalProduk);
	}

	public String getTotalHarga() {
		return String.valueOf(totalHarga.toBigInteger());
	}

	public String getMetode() {
		switch (metode) {
		case TUNAI:
			return "Tunai Semua";
		case HUTANG:
			return "Hutang Semua";
		case BOTH:
			return "Tunai dan Hutang";

		default:
			return "Data tidak diketahui";
		}
	}
}